package com.imooc.controller;

import com.imooc.constant.CookieConstant;
import com.imooc.constant.RedisConstant;
import com.imooc.dataobject.SellerInfo;
import com.imooc.enums.ResultEnum;
import com.imooc.form.ProductForm;
import com.imooc.utils.CookieUtil;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

@Controller
@RequestMapping("/seller/user")
public class SellerUserV2Controller {
    @GetMapping("/login")
    public ModelAndView login(){
        return new ModelAndView("user/login");
    }

    @PostMapping("/login2")
        public ModelAndView login2(String username,String password){
        Map<String,String> map = new HashMap<>();

        if (username.equals("root") && password .equals("123456") ){
            map.put("msg","登录成功");
            map.put("url","/sell/seller/product/index");
            return new ModelAndView("common/success",map);
        }else {
            map.put("msg","账户名或者密码错误");
            map.put("url","/sell/seller/user/login");
            return new ModelAndView("common/error",map);
        }
    }


}
